{template '_header'}
<style>
    .select2{
        margin:0;
        width:100%;
        height:34px;
        border-radius: 3px;
        border-color: rgb(229, 230, 231);
    }
    .select2 .select2-choice{
        height: 34px;
        line-height: 32px;
        border-radius: 3px;
        border-color: rgb(229, 230, 231);
    }
    .select2 .select2-choice .select2-arrow{
        background: #fff;
    }
</style>
<div class="page-header">
    <div class="pull-right" style="text-align: right;" >
        <strong>高级模式</strong>
        <input class="js-switch small" type="checkbox" {if !empty($data['tm']['is_advanced'])}checked{/if}/>
    </div>
    当前位置：<span class="text-primary">通知设置</span>
</div>
<div class="page-content">
    <form id="setform"  action="" method="post" class="form-horizontal form-validate">
        <input type="hidden" value="{php echo intval($data['tm']['is_advanced'])}" name='data[is_advanced]' />
        <div class='alert alert-primary'>
            默认为全部开启，用户在会员中心可自行设置是否开启, 模板消息自动替换变量
        </div>
        <div class='alert alert-primary'>
            使用高级模式 , 将全部启用自定义的模板内容进行推送 !
        </div>

        <div class="form-group normal">
            <label class="col-lg control-label">任务处理通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[templateid]" class="form-control" value="{$data['tm']['templateid']}" />
                <div class="help-block">公众平台模板消息编号: OPENTM200605630 </div>
            </div>
        </div>

        <div class="form-group-title">商家通知 - 入驻申请</div>

        <div class="form-group">
            <label class="col-lg control-label">选择通知人</label>
            <div class="col-sm-9 col-xs-12">
                {ifp 'merch.notice.edit'}
                {php echo tpl_selector('openids',array('key'=>'openid','text'=>'nickname', 'thumb'=>'avatar','multi'=>1,'placeholder'=>'昵称/姓名/手机号','buttontext'=>'选择通知人', 'items'=>$salers,'url'=>webUrl('member/query') ))}
                <span class='help-block'>选择多商户下面所有通知的通知人，可以指定多个人，如果不填写则不通知</span>
                {else}
                <div class="input-group multi-img-details" id='saler_container'>
                    {loop $salers $saler}
                    <div class="multi-item saler-item" openid='{$saler['openid']}'>
                    <img class="img-responsive img-thumbnail" src='{$saler['avatar']}' onerror="this.src='./resource/images/nopic.jpg'; this.title='图片未找到.'">
                    <div class='img-nickname'>{$saler['nickname']}</div>
                    <input type="hidden" value="{$saler['openid']}" name="openids[]">
                    {/loop}
                </div>
                {/if}
            </div>
        </div>
        <div class="normal">
            <div class="form-group">
                <label class="col-lg control-label">标题</label>
                <div class="col-sm-9 col-xs-12">
                    <input type="text" name="data[merch_applytitle]" class="form-control" value="{$data['tm']['merch_applytitle']}" />
                    <div class="help-block">标题，默认"商户入驻申请"</div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg control-label">内容</label>
                <div class="col-sm-9 col-xs-12">
                    <textarea  name="data[merch_apply]" class="form-control textarea"rows="5" >{$data['tm']['merch_apply']}</textarea>
                  <div class="variable">
                      模板变量: [商户名称] [主营项目] [联系人] [手机号] [申请时间]
                      <br/>如果不填写默认内容为: [商户名称]在[申请时间]提交了入驻申请，请到后台查看~
                  </div>
                </div>
            </div>
        </div>
        <div class="advanced">
            <div class="form-group">
                <label class="col-lg control-label">入驻申请</label>
                <div class="col-sm-9 col-xs-12">
                    <select class="select2" name="data[merch_apply_advanced]">
                        <option>从模板消息库中选择</option>
                        {loop $template_list $template_val}
                        <option value="{$template_val['id']}" {if $data['tm']['merch_apply_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
        </div>
        <div class="form-group" style="display: {if $opensms}block{else}none{/if};">
            <label class="col-lg control-label">短信通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[merch_apply_sms]">
                    <option value="0">从短信模板库中选择</option>
                    {loop $template_sms $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['merch_apply_sms'] == $template_val['id'] }selected{/if}>{$template_val['name']}</option>
                    {/loop}
                </select>
            </div>
        </div>
        <div class="form-group" style="display: {if $opensms}block{else}none{/if};">
            <label class="col-lg control-label">短信通知人</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="data[mobiles]" rows="5">{$data['tm']['mobiles']}</textarea>
                <div class="help-block">可填写多个手机号以英文逗号隔开(,)，提醒人为空或者未选择短信模板则不发送</div>
            </div>
        </div>

        <div class="form-group-title">商家通知 - 提现申请提交通知</div>

        <div class="form-group">
            <label class="col-lg control-label">提现申请通知人</label>
            <div class="col-sm-9 col-xs-12">
                {ifp 'merch.notice.edit'}
                {php echo tpl_selector('applyopenids',array('key'=>'openid','text'=>'nickname', 'thumb'=>'avatar','multi'=>1,'placeholder'=>'昵称/姓名/手机号','buttontext'=>'选择通知人', 'items'=>$applysalers,'url'=>webUrl('member/query') ))}
                <span class='help-block'>选择多商户下面所有通知的通知人，可以指定多个人，如果不填写则不通知</span>
                {else}
                <div class="input-group multi-img-details" id='saler_container_apply'>
                    {loop $applysalers $saler}
                    <div class="multi-item saler-item" applyopenid='{$saler['openid']}'>
                        <img class="img-responsive img-thumbnail" src='{$saler['avatar']}' onerror="this.src='./resource/images/nopic.jpg'; this.title='图片未找到.'">
                        <div class='img-nickname'>{$saler['nickname']}</div>
                        <input type="hidden" value="{$saler['openid']}" name="applyopenids[]"/>
                    </div>
                    {/loop}
                </div>
                {/if}
            </div>
        </div>

        <div  class="normal">
            <div class="form-group">
                <label class="col-lg control-label">标题</label>
                <div class="col-sm-9 col-xs-12">
                    {ifp 'merch.notice.edit'}
                    <input type="text" name="data[merch_applymoneytitle]" class="form-control" value="{$data['tm']['merch_applymoneytitle']}" />
                    <div class="help-block">标题，默认"提现申请提交通知"</div>
                    {else}
                    <div class='form-control-static'>{$data['tm']['merch_applymoneytitle']}</div>
                    {/if}
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg control-label">内容</label>
                <div class="col-sm-9 col-xs-12">
                    {ifp 'merch.notice.edit'}
                    <textarea  name="data[merch_applymoney]" class="form-control" rows="5">{$data['tm']['merch_applymoney']}</textarea>
                  <div class="variable">  模板变量  [商户名称] [金额] [联系人] [手机号] [申请时间]</div>
                    {else}
                    <div class='form-control-static'>{$data['tm']['merch_applymoney']}</div>
                    {/if}
                </div>
            </div>
        </div>
        <div class="advanced">
            <div class="form-group">
                <label class="col-lg control-label">提现申请提交通知</label>
                <div class="col-sm-9 col-xs-12">
                    <select class="select2" name="data[merch_applymoney_advanced]">
                        <option>从模板消息库中选择</option>
                        {loop $template_list $template_val}
                        <option value="{$template_val['id']}" {if $data['tm']['merch_applymoney_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
        </div>

        <div class="form-group" style="display: {if $opensms}block{else}none{/if};">
            <label class="col-lg control-label">短信通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[merch_applymoney_sms]">
                    <option value="0">从短信模板库中选择</option>
                    {loop $template_sms $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['merch_applymoney_sms'] == $template_val['id'] }selected{/if}>{$template_val['name']}</option>
                    {/loop}
                </select>
            </div>
        </div>
        <div class="form-group" style="display: {if $opensms}block{else}none{/if};">
            <label class="col-lg control-label">短信通知人</label>
            <div class="col-sm-9 col-xs-12">
                <textarea class="form-control" name="data[applymobiles]"rows="5">{$data['tm']['applymobiles']}</textarea>
                <div class="help-block">可填写多个手机号以英文逗号隔开(,)，提醒人为空或者未选择短信模板则不发送</div>
            </div>
        </div>


            <div class="form-group">
                <label class="col-lg control-label"></label>
                <div class="col-sm-9">
                    <input type="submit" value="提交" class="btn btn-primary" />
                </div>
            </div>
    </form>
</div>
<script>
    $(function () {
        $(".js-switch").click(function () {
            $(":input[name='data[is_advanced]']").val( this.checked ?1:0);
            if (this.checked)
            {
                $(".advanced").show();
                $(".alert-success").show();
                $(".normal").hide();
                $(".alert-info").hide();
            }
            else
            {
                $(".advanced").hide();
                $(".alert-success").hide();
                $(".normal").show();
                $(".alert-info").show();
            }
        })

        if($(":input[name='data[is_advanced]']").val() == 1)
        {
            $(".advanced").show();
            $(".alert-success").show();
            $(".normal").hide();
            $(".alert-info").hide();
        }
        else
        {
            $(".advanced").hide();
            $(".alert-success").hide();
            $(".normal").show();
            $(".alert-info").show();
        }
    })
</script>
{template '_footer'}
<!--913702023503242914-->